import request from '../../../../../public/js/common/api/api.js';

const SaleUrl = Utils.CurDomain.SaleUrl;
const BaseCfgUrl = Utils.CurDomain.BaseCfgUrl;
const SubDataUrl = Utils.CurDomain.SubDataUrl;
const AccountUrl = Utils.CurDomain.AccountUrl;
const SysPlfUrl = Utils.CurDomain.SysPlfUrl;

const configuration = {
    contentType: 'application/json',
    dataType: 'json',
    async: true,
    dataFilter(data, type) {
        return data;
    }
}
export default class vehicleApi {
    // 获取农场
    static queryComDepList(upoid, aotype, taginfo) {
        return request.get(`${SysPlfUrl}/yyorgunits/by/q?upoid=${upoid}&aotype=${aotype}&taginfo=${taginfo}`);
    }
    // 获取组织
    static getOrgSaleList() {
        return request.get(`${SysPlfUrl}/yyorgunits/by/q/sale`);
    }
    // 获取登录用户拥有组织
    static postUserOrgsList() {
        return request.get(`${AccountUrl}/accounts/orgs`);
    }
    // 获取养殖批次
    static getBreedbatchsList(data) {
        return request.post(`${BaseCfgUrl}/breedbatchs/list`, data)
    }

    static getBreedbatchsListUrl = `${BaseCfgUrl}/breedbatchs/rlist`
    // 新增销售计划
    static addSalePlan(data) {
        return request.post(`${SaleUrl}/planbills`, data)
    }
    // 新增销售计划
    static updateSalePlan(data) {
        return request.put(`${SaleUrl}/planbills/${data.id}`, data)
    }
    // 获取销售计划详情
    static getSalePlanDetail(data) {
        return request.get(`${SaleUrl}/planbills/${data.id}`)
    }
    // 获取销售计划列表
    static getSalePlanList(data) {
        return request.post(`${SaleUrl}/planbills/plist`, data)
    }
    // 提交
    static submitSalePlan(id) {
        return request.put(`${SaleUrl}/planbills/submit/${id}`)
    }
    // 反提交
    static unsubmitSalePlan(id) {
        return request.put(`${SaleUrl}/planbills/resubmit/${id}`)
    }
    // 审批
    static auditSalePlan(id, count) {
        let auditcount = {
            "checkCount": count
        }
        return request.put(`${SaleUrl}/planbills/audit/${id}`, auditcount)
    }
    // 反审批
    static unauditSalePlan(id) {
        return request.put(`${SaleUrl}/planbills/reaudit/${id}`)
    }
    // 删除
    static deleteSalePlan(id) {
        return request.delete(`${SaleUrl}/planbills/${id}`)
    }
    // 获取正负差
    static getDifference(id) {
        return request.get(`${SubDataUrl}/prmtsettings/${id}/value`);
    }

    // 查询用户信息
    static queryUserName(sid) {
        return request.get(`${Utils.CurDomain.WeiXinUrl}/wxauths/cur?sid=${sid}`);
    }
}